﻿Imports System.IO

Module modGlobalFunctions

    Public Sub LoadListProjectInfo(ByVal inMainDirectory As String)
        If inMainDirectory <> "" Then
            glistProjectsInfo.Add(New ProjectInfo("API_UT", PutSlash(inMainDirectory) & "API\API_UT"))
            glistProjectsInfo.Add(New ProjectInfo("RCEPOU_UT", PutSlash(inMainDirectory) & "POU\RCEPOU_UT"))
            glistProjectsInfo.Add(New ProjectInfo("CoreBase_UT", PutSlash(inMainDirectory) & "CORE\CoreBase\CoreBase_UT"))
            glistProjectsInfo.Add(New ProjectInfo("Commands_UT", PutSlash(inMainDirectory) & "CORE\Commands\Commands_UT"))
            glistProjectsInfo.Add(New ProjectInfo("HTL_UT", PutSlash(inMainDirectory) & "CORE\HTL\HTL_UT"))
            glistProjectsInfo.Add(New ProjectInfo("Kinematics_UT", PutSlash(inMainDirectory) & "CORE\Kinematics\Kinematics_UT"))
            glistProjectsInfo.Add(New ProjectInfo("Kinematics_AUT", PutSlash(inMainDirectory) & "CORE\Kinematics\Kinematics_AUT"))
            glistProjectsInfo.Add(New ProjectInfo("Trajectories_UT", PutSlash(inMainDirectory) & "CORE\Trajectories\Trajectories_UT"))
            glistProjectsInfo.Add(New ProjectInfo("Workspace_UT", PutSlash(inMainDirectory) & "CORE\Workspace\Workspace_UT"))
        End If
    End Sub

    Public Function PutSlash(ByVal inPath As String) As String
        If inPath.EndsWith("\") Then
            Return inPath
        Else
            Return inPath & "\"
        End If
    End Function

    Public Function GetInitDir(ByVal strLastINIFile As String) As String
        If strLastINIFile = "" Then
            Return My.Computer.FileSystem.SpecialDirectories.Desktop
        Else
            Return Path.GetDirectoryName(strLastINIFile)
        End If
    End Function

End Module
